# encoding: UTF-8
"""

@author = 李林名
@email = lishuai1199@qq.com
@create_time = 2022/11/17 22:30

"""
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep


# #1.根据子后代元素选择元素: 子元素和后代元素组合: 苏ICP备88885574号
# wd = webdriver.Chrome()
# wd.get('https://cdn2.byhy.net/files/selenium/sample1.html')
# ## 根据属性选择元素
# element = wd.find_element(By.CSS_SELECTOR, '#bottom>.footer2 a')
# ## 打印出元素对应的html
# print(element.get_attribute('innerHTML'))
# sleep(1)


#2.根据属性选择元素: [属性值]: 苏ICP备88885574号
wd = webdriver.Chrome()
wd.get('https://cdn2.byhy.net/files/selenium/sample1.html')
## 根据属性选择元素
element = wd.find_element(By.CSS_SELECTOR, '[href="http://www.miitbeian.gov.cn"]')
## 打印出元素对应的html
print(element.get_attribute('innerHTML'))
sleep(1)